<div class="bjui-pageContent" >
        <div data-layout-h="0">
                <!-- 内容区 -->
                <form action="{:U('Advertisement/advertisement_add')}" class="pageForm nice-validator n-red"  data-loadingmask='false' data-toggle="validate" novalidate="novalidate" method="post" >
                        <input type="hidden" name="id" value="{$_GET.id|default=''}" />
                        <!-- navtab类型判断 -->
                        <input type="hidden" name="navTabname" value="Advertisement/ad_index" />
                        <table  style="margin-top: 20px;">
                                <tr >
                                        <td><label style='margin-left:40px;'>广告标题：</label></td>
                                        <td>
                                                <input type="text" name="title" data-rule="required" size="40"  value="{$ad.title|default=''}" />
                                        </td>

                                </tr>
                                <tr>
                                        <td width='150'><label style='margin-left:40px;'>广告类别：</label></td>
                                        <td>
                                                <select data-toggle="selectpicker" data-rule='required' name="typeid" >
                                                        <option value="">选择广告分类</option>
                                                        {volist name="ad_cat" id="vo"}
                                                        <option value="{$vo.typeid}" {eq name="ad.typeid" value="$vo['typeid']"} selected{/eq}>{$vo.typename}</option>
                                                        {/volist}
                                                </select>   
                                        </td>

                                </tr>
                                <tr>
                                        <td width='150'><label style='margin-left:40px;'>数据类别：</label></td>
                                        <td>
                                                <select data-toggle="selectpicker" data-rule='required' name="sort" >
                                                        <option value="">选择</option>
                                                        <option value="1" {eq name="ad.sort" value="1"} selected="selected"{/eq}>代码广告</option>
                                                        <option value="2" {eq name="ad['sort']" value="2"} selected="selected"{/eq}>图片广告</option>
                                                        <option value="3" {eq name="ad['sort']" value="3"} selected="selected"{/eq}>FLASH广告</option>
                                                        <option value="4" {eq name="ad['sort']" value="4"} selected="selected"{/eq}>JS广告代码</option>
                                                </select>   
                                        </td>

                                </tr>
                                <tr >
                                        <td><label style='margin-left:40px;'>内容摘要:</label></td>
                                        <td>
                                                <textarea  name="content" rows="3" cols="40">{$ad.content|default=''}</textarea>
                                        </td>

                                </tr>
                                <tr >
                                        <td><label style='margin-left:40px;'>广告链接：</label></td>
                                        <td>
                                                <input type="text" name="adurl" data-rule="required" size="20" value="{$ad.adurl|default=''}" /> 
                                        </td>

                                </tr>
                                <tr >
                                        <td><label style='margin-left:40px;'>宽度：</label></td>
                                        <td>
                                                <input type="text" name="ad_w" size="20" value="{$ad.ad_w|default=''}" /> 
                                        </td>

                                </tr>
                                <tr >
                                        <td><label style='margin-left:40px;'>高度：</label></td>
                                        <td>
                                                <input type="text" name="ad_h" size="20"  value="{$ad.ad_h|default=''}" />  
                                        </td>

                                </tr>
                                <tr>
                                        <td width='150'><label style='margin-left:40px;'>广告状态:</label></td>
                                        <td>
                                                <select data-toggle="selectpicker" data-rule='required' name="state" >
                                                        <option value="0" {eq name="ad.state" value="0"} selected="selected"{/eq}>未审核</option>
                                                        <option value="1" {eq name="ad['state']" value="1"} selected="selected"{/eq}>审核</option>
                                                </select>   
                                        </td>

                                </tr>
                                <tr>
                                        <td width='150'><label style='margin-left:40px;'>上传图片:</label></td>
                                        <td>
                                                <input type="hidden" id="thumbnail_text" name="filename" value="{$ad.filename|default=''}" size="60" />
                                                <input type="button" id="thumbnail_btn" class="btn btn-info" value="选择图片" />
                                                <div class="alert alert-warning form-inline"><i class="fa fa-warning"></i> (允许上传的文件:jpg,png,gif) </div>
                                                
                                        </td>

                                </tr>
                                <tr>
                                        <td width='150'><label style='margin-left:40px;'>&nbsp;</label></td>
                                        <td>
                                                {neq name='ad.filename' value=''}
                                                <img src='{$ad.filename}' width="100px" height="100px" style="margin-top:20px;"/>
                                                {/neq}
                                        </td>
                                </tr>



                        </table>
                </form>
        </div>

</div>
<div class="bjui-pageFooter" border='none'>
        <ul>
                <li><button type="button" class="btn btn-close">关闭</button></li>
                <li><button type="submit" class="btn btn-default">提交</button></li>
        </ul>
</div>
<script type="text/javascript">
        // 单独调用KindEditor图片插件
        var editor = KindEditor.editor({
                allowFileManager: true
        });
        KindEditor('#thumbnail_btn').click(function() {
                editor.loadPlugin('image', function() {
                        editor.plugin.imageDialog({
                                imageUrl: KindEditor('#url1').val(),
                                clickFn: function(url, title, width, height, border, align) {
                                        KindEditor('#thumbnail_text').val(url);
                                        editor.hideDialog();
                                }
                        });
                });
        });

</script>
